<template>
  <div class="table-page-search-wrapper">
    <el-form :model="searchForm" ref="searchForm" label-width="100px" class="demo-ruleForm">
      <el-row>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="总订单号:">
            <el-input v-model="searchForm.payOrderNo" placeholder="请输入总订单号" />
          </el-form-item>
         </el-col>
         <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="订单编号:">
            <el-input v-model="searchForm.subOrderId" placeholder="请输入订单编号" />
          </el-form-item>
        </el-col>
        <!-- <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="联系电话:">
            <el-input v-model="searchForm.phone" placeholder="请输入联系电话" />
          </el-form-item>
        </el-col> -->
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="订单状态:">
            <el-select v-model="searchForm.orderStatus" placeholder="请选择订单状态" style="width:100%">
              <el-option
                v-for="item in statuslist"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="创建时间:">
            <el-date-picker
              v-model="serviceTime"
              type="datetimerange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width:100%"
              :default-time="['00:00:00', '23:59:59']"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="订单来源:">
            <el-select v-model="searchForm.orderSource" placeholder="请选择订单来源" style="width:100%">
              <el-option
                v-for="item in laiyuanList"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="所属门店:">
            <el-input v-model="searchForm.companyName" placeholder="请输入门店名称" />
          </el-form-item>
        </el-col>-->
        <!-- <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="配送方式:">
            <el-select v-model="searchForm.status" placeholder="请选择配送方式" style="width:100%">
              <el-option
                v-for="item in fangShilist"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>-->
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <div style="margin-left:30px">
            <el-button type="primary" icon="el-icon-search" @click="searchAction()">查询</el-button>
            <el-button icon="el-icon-refresh" @click="resetSearch()" style="margin-left: 8px;">重置</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
export default {
  name: "search",
  props: ["keyName"],
  data() {
    return {
      statuslist: [
        {
          label: "支付成功",
          value: "00",
        },
        {
          label: "支付失败",
          value: "01",
        },
        {
          label: "待支付",
          value: "02",
        },
        {
          label: "支付中",
          value: "03",
        },
        {
          label: "作废",
          value: "04",
        },
      ], //订单状态
      laiyuanList: [
        {
          label: "全部",
          value: "",
        },
        {
          label: "线下",
          value: "02",
        },
        {
          label: "APP",
          value: "01",
        },
        {
          label: "小程序",
          value: "00",
        },
      ], //订单来源
      fangShilist: [], //配送方式
      searchForm: {},
      serviceTime: [],
    };
  },
  methods: {
    searchAction() {
      //执行搜索
      if (this.serviceTime.length) {
        this.searchForm.startTime = this.formDate(this.serviceTime[0]);
        this.searchForm.endTime = this.formDate(this.serviceTime[1]);
      }
      this.$emit("search");
    },
    resetSearch() {
      this.searchForm = {};
      this.serviceTime = [];
      this.$emit("resetSearch");
    },
    getSearchForm() {
      //获取高级搜索条件
      return {
        ...this.searchForm,
      };
    },
  },
};
</script>


<style lang="less">
</style>>
